package com.example.tests;

//import java.util.Random;
import java.util.Set;
import java.util.logging.Logger;

import org.testng.annotations.*;
import com.example.data.GroupData;

public class GroupCreationTest extends TestBase{

	private Logger log = Logger.getLogger("GroupCreationTest");
	
	@Test(dataProvider = "groupsFromFile", dataProviderClass = GroupDataGenerator.class)
	public void groupCreationTest(GroupData group) throws Exception {
		log.info("groupCreationTest starting");
		//get list of groups
		Set<GroupData> oldList = manager.getGroupHelper().getGroupsList();
		log.info("oldList = " + oldList);
		//add new group
		manager.getGroupHelper().createGroup(group);
		log.info("group = " + group);
		//get list of groups again
		Set<GroupData> newList = manager.getGroupHelper().getGroupsList();
		System.out.println("newList = " + newList);
		log.info("newlist = " + newList);
		//compare lists
		verifyGroupAdded(oldList, group, newList);
	}

	@Test
	public void emptyGroupCreationTest() throws Exception {
		Set<GroupData> oldList = manager.getGroupHelper().getGroupsList();
		GroupData group = new GroupData().setName("").setHeader("").setFooter("");
		manager.getGroupHelper().createGroup(group);
		Set<GroupData> newList = manager.getGroupHelper().getGroupsList();
		//compare lists
		verifyGroupAdded(oldList, group, newList);
	}
}
